/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package dao;

import org.jmock.Expectations;
import org.jmock.Mockery;
import org.jmock.integration.junit4.JMock;
import org.jmock.integration.junit4.JUnit4Mockery;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;

/**
 *
 * @author jfernan
 */

@RunWith(JMock.class)
public class DateServiceTest_jmock {



         Mockery context = new JUnit4Mockery();


private DateDAO dateDAO;
	private DateService dateService;

	@Before
	public void setUp() throws Exception {
		dateDAO = context.mock(DateDAO.class);
		dateService = new DateService();
		dateService.setDateDAO(dateDAO);
	}

	@Test
	public void testGetMatchPaid() {

                   context.checking(new Expectations() {{
            oneOf (dateDAO).findByCharacter("Cheap");
            will(returnValue( new Person("Cheapy", "", "", true) ));

        }});


		Person toMatch =
			new Person("Cheap", "Tight", "Pants", true);
		assertEquals(new Person("Cheapy", "", "", true),
				dateService.getMatch(toMatch));

	}

	@Test
	public void testGetMatchNotPaid() {
            
	   Person toMatch =
	           new Person("Cheap", "Tight", "Pants", false);
	   assertEquals(new Person("Loving", "Your", "Mom", false),
	          dateService.getMatch(toMatch));
	}


}